package org.baicaixiaozhan.emailmanager.controller;

import lombok.AllArgsConstructor;
import org.baicaixiaozhan.emailmanager.auth.ApplicationUser;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * DESC:
 *
 * @author : baicaixiaozhan
 * @since : 2021-06-20
 */
@Controller
@RequestMapping("/")
@AllArgsConstructor
public class TemplatesController {

    private final UserDetailsService userDetailsService;

    @GetMapping("/findUser")
    @ResponseBody
    public ApplicationUser findUser() {
        return (ApplicationUser) userDetailsService.loadUserByUsername("zhangsan");
    }
}
